<%--
  Created by IntelliJ IDEA.
  User: 28912
  Date: 2022/11/6
  Time: 10:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<head>
    <link rel="stylesheet" type="text/css" href="../../../web_01-1.0-SNAPSHOT/static/css/web_01.css"/>
    <meta charset="UTF-8">
    <title>stulogin</title>
</head>
<body>
<div class="login_01">
    <div class="login_02">
        您可以实现对学生信息的增删改查！
    </div>
    <div class="login_03" align="center">
        欢迎${user.getU_name()}！
        <br />
        <div class="select" align="center">
            <input type="text" placeholder="请输入学号来查询" class="itxt1" id="text01">
            <button class="but01" id="btn02">查询</button>
            <button class="but01" id="btn04">添加学生</button>
        </div>
        <span color="red">${error}</span>
        <script>
            let btn01 = document.getElementById("btn02");
            btn01.onclick = function(){
                let text01 = document.getElementById("text01").value;
                window.location.href = "/web/select?id="+text01;
                return false;
            }

            let btn02 = document.getElementById("btn04");
            btn02.onclick = function(){
                window.location.href = "/web/add.jsp";
                return false;
            }

            function Updata(u) {
                window.location.href = "/web/toUpdate?id="+u;
                return false;
            }

            function Delete(d) {
                window.location.href = "/web/del?id="+d;
                return false;
            }
        </script>
        <br />
        <table align="center" border="black 1px solid" cellspacing="0" width="700px">
            <tr>
                <th>学号</th>
                <th>姓名</th>
                <th>密码</th>
                <th>性别</th>
                <th>班级</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${arr}" var="item">
                <tr>
                    <td>${item.getU_id()}</td>
                    <td>${item.getU_name()}</td>
                    <td>${item.getU_pwd()}</td>
                    <td>${item.getU_sex()}</td>
                    <td>${item.getU_class()}</td>
                    <td>
                        <button onclick="Updata(${item.getU_id()})">修改信息</button>
                        <button onclick="Delete(${item.getU_id()})">删除信息</button>
                    </td>
                </tr>
            </c:forEach>
        </table>
    </div>
</div>
</body>
